#include "ServoBase.h"


// CServoBus
CServoBus::CServoBus()
{
	m_id = 0;
	m_serlPtr = NULL;
	m_waitMsec = 10;
}

CServoBus::~CServoBus()
{
}

ServoRet_t CServoBus::Init(uint8_t id, HardwareSerial *serl, int waitMsec)
{
	if (NULL == serl || waitMsec < 0) {
		return SERVO_RET_ERROR;
	}

	m_id = id;
	m_serlPtr = serl;
	m_waitMsec = waitMsec;
	return SERVO_RET_SUCCESS;
}

void CServoBus::Uninit()
{
	m_id = 0;
	m_serlPtr = NULL;
	m_waitMsec = 10;
}


// CServoPWM
CServoPWM::CServoPWM()
{
	m_pin = -1;
}

CServoPWM::~CServoPWM()
{
}

ServoRet_t CServoPWM::Init(int pin)
{
	if (pin < 0) {
		return SERVO_RET_ERROR;
	}

	m_pin = pin;
	return SERVO_RET_SUCCESS;
}

void CServoPWM::Uninit()
{
	m_pin = -1;
}

